package com.bjsxt.usersCenter.common.util;

import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class ConstatFinalUtil
{
	public static final Logger LOGGER=LogManager.getLogger(ConstatFinalUtil.class);
	public static JSONObject RESOURCE_JSON=new JSONObject();
	public static JSONObject INFO_JSON=new JSONObject();
	/**
	 * 存储所有的token
	 */
	public static Map<String,JSONObject> TOKENS_MAP=new HashMap<String, JSONObject>();
	/*读取属性文件*/
	public static ResourceBundle bundle=ResourceBundle.getBundle("common");
	/**
	 * 存储随机数的字母表
	 */
	public static String ALLSTR="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	
	
	static
	{
		FileUtil fileUtil=new FileUtil();
		try
		{
			String resourceStr=fileUtil.readFile(ConstatFinalUtil.class.getClassLoader().getResourceAsStream("resourceInfo.json"));
			RESOURCE_JSON=(JSONObject) JSON.parse(resourceStr);
			INFO_JSON=RESOURCE_JSON.getJSONObject("info");
			ConstatFinalUtil.LOGGER.info("JSON配置文件");
		} catch (Exception e)
		{
			ConstatFinalUtil.LOGGER.error("JSON配置文件转换报错",e);
		}
		
	}


}
